package com.betterjr.modules.risk.loanmanage.entity;

import java.math.BigDecimal;
import java.sql.Timestamp;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.betterjr.common.annotation.MetaData;
import com.betterjr.common.entity.BetterjrEntity;

@Access(AccessType.FIELD)
@Entity
@Table(name = "t_payment_plan")
public class PaymentPlan implements BetterjrEntity {
    public static final String selectKey = "PaymentPlan.id";
    /**
     * ID
     */
    @Id
    @Column(name = "ID", columnDefinition = "INTEGER")
    @MetaData(value = "ID", comments = "ID")
    private Long id;

    /**
     * 合同ID
     */
    @Column(name = "P_CONTRACT_ID", columnDefinition = "INTEGER")
    @MetaData(value = "合同ID", comments = "合同ID")
    private Long contractId;

    /**
     * 放款数据ID
     */
    @Column(name = "P_LOAN_DATA_ID", columnDefinition = "INTEGER")
    @MetaData(value = "放款数据ID", comments = "放款数据ID")
    private Long loanDataId;

    /**
     * 明细ID
     */
    @Column(name = "P_DETAILS_ID", columnDefinition = "INTEGER")
    @MetaData(value = "明细ID", comments = "明细ID")
    private Long detailsId;

    /**
     * 金额
     */
    @Column(name = "N_AMOUNT", columnDefinition = "DECIMAL")
    @MetaData(value = "金额", comments = "金额")
    private BigDecimal amount;

    /**
     * 扣款日期
     */
    @Column(name = "D_PAYMENT_DATE", columnDefinition = "DATETIME")
    @MetaData(value = "扣款日期", comments = "扣款日期")
    private Timestamp paymentDate;

    /**
     * 扣款类型，还息：0，还本：1 ,服务费2
     */
    @Column(name = "C_PAYMENT_TYPE", columnDefinition = "CHAR")
    @MetaData(value = "扣款类型", comments = "扣款类型，还息：0，还本：1 ,服务费2")
    private String paymentType;

    /**
     * 扣款方式
     */
    @Column(name = "C_PAYMENT_MODE", columnDefinition = "CHAR")
    @MetaData(value = "扣款方式", comments = "扣款方式")
    private String paymentMode;

    /**
     * 扣款客户标识
     */
    @Column(name = "N_PAYMENT_CUSTOMER_ID", columnDefinition = "INTEGER")
    @MetaData(value = "扣款客户NO", comments = "扣款客户NO")
    private Long paymentCustomerId;

    /**
     * 扣款账户名称
     */
    @Column(name = "C_PAYMENT_ACCOUNT_NAME", columnDefinition = "VARCHAR")
    @MetaData(value = "扣款账户名称", comments = "扣款账户名称")
    private String paymentAccountName;

    /**
     * 扣款账户帐号
     */
    @Column(name = "C_PAYMENT_ACCOUNT_NO", columnDefinition = "VARCHAR")
    @MetaData(value = "扣款账户帐号", comments = "扣款账户帐号")
    private String paymentAccountNo;

    /**
     * 扣款开户行
     */
    @Column(name = "C_PAYMENT_ACCOUNT_BANK", columnDefinition = "VARCHAR")
    @MetaData(value = "扣款开户行", comments = "扣款开户行")
    private String paymentAccountBank;

    /**
     * 扣款联行号
     */
    @Column(name = "C_PAYMENT_BANK_NO", columnDefinition = "VARCHAR")
    @MetaData(value = "扣款联行号", comments = "扣款联行号")
    private String paymentBankNo;

    /**
     * 扣款账户可归集列表
     */
    @Column(name = "C_PAYMENT_ACCOUNTS", columnDefinition = "VARCHAR")
    @MetaData(value = "扣款账户可归集列表", comments = "扣款账户可归集列表")
    private String paymentAccounts;

    /**
     * 收款账户名称
     */
    @Column(name = "C_RECEIVE_ACCOUNT_NAME", columnDefinition = "VARCHAR")
    @MetaData(value = "收款账户名称", comments = "收款账户名称")
    private String receiveAccountName;

    /**
     * 收款账户帐号
     */
    @Column(name = "C_RECEIVE_ACCOUNT_NO", columnDefinition = "VARCHAR")
    @MetaData(value = "收款账户帐号", comments = "收款账户帐号")
    private String receiveAccountNo;

    /**
     * 收款开户行
     */
    @Column(name = "C_RECEIVE_ACCOUNT_BANK", columnDefinition = "VARCHAR")
    @MetaData(value = "收款开户行", comments = "收款开户行")
    private String receiveAccountBank;

    /**
     * 收款联行号
     */
    @Column(name = "C_RECEIVE_BANK_NO", columnDefinition = "VARCHAR")
    @MetaData(value = "收款联行号", comments = "收款联行号")
    private String receiveBankNo;

    /**
     * 规则信息，如提前X天
     */
    @Column(name = "C_RULE_JSON", columnDefinition = "VARCHAR")
    @MetaData(value = "规则信息", comments = "规则信息，如提前X天")
    private String ruleJson;

    /**
     * 激活标志（是否推送运资金）0推送
     */
    @Column(name = "C_ACTIVATION_FLAG", columnDefinition = "CHAR")
    @MetaData(value = "激活标志（是否推送运资金）0推送", comments = "激活标志（是否推送运资金）0推送")
    private String activationFlag;

    /**
     *  -1没完成(默认)，0完成，1部分完成，2逾期 ，3取消
     */
    @Column(name = "C_STATUS", columnDefinition = "CHAR")
    @MetaData(value = " -1没完成(默认)", comments = " -1没完成(默认)，0完成，1部分完成，2逾期 ，3取消")
    private String status;

    /**
     * 创建时间
     */
    @Column(name = "D_CREATE_DATE", columnDefinition = "DATETIME")
    @MetaData(value = "创建时间", comments = "创建时间")
    private Timestamp createDate;

    /**
     * 创建人
     */
    @Column(name = "C_CREATOR", columnDefinition = "VARCHAR")
    @MetaData(value = "创建人", comments = "创建人")
    private String creator;

    /**
     * 创建人ID
     */
    @Column(name = "N_CREATOR_ID", columnDefinition = "INTEGER")
    @MetaData(value = "创建人ID", comments = "创建人ID")
    private Long creatorId;

    /**
     * 最后更新时间
     */
    @Column(name = "D_UPDATE_DATE", columnDefinition = "DATETIME")
    @MetaData(value = "最后更新时间", comments = "最后更新时间")
    private Timestamp updateDate;

    /**
     * 最后更新人
     */
    @Column(name = "C_UPDATE_CREATOR", columnDefinition = "VARCHAR")
    @MetaData(value = "最后更新人", comments = "最后更新人")
    private String updateCreator;

    /**
     * 最后更新人ID
     */
    @Column(name = "N_UPDATE_CREATOR_ID", columnDefinition = "INTEGER")
    @MetaData(value = "最后更新人ID", comments = "最后更新人ID")
    private Long updateCreatorId;

    /**
     * 客户标识
     */
    private String customerIdentification;

    private static final long serialVersionUID = 1530323479172L;

    public Long getId() {
        return id;
    }

    public void setId(final Long id) {
        this.id = id;
    }

    public Long getContractId() {
        return contractId;
    }

    public void setContractId(final Long contractId) {
        this.contractId = contractId;
    }

    public Long getLoanDataId() {
        return loanDataId;
    }

    public void setLoanDataId(final Long loanDataId) {
        this.loanDataId = loanDataId;
    }

    public Long getDetailsId() {
        return detailsId;
    }

    public void setDetailsId(final Long detailsId) {
        this.detailsId = detailsId;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(final BigDecimal amount) {
        this.amount = amount;
    }

    public Timestamp getPaymentDate() {
        return paymentDate;
    }

    public void setPaymentDate(final Timestamp paymentDate) {
        this.paymentDate = paymentDate;
    }

    public String getPaymentType() {
        return paymentType;
    }

    public void setPaymentType(final String paymentType) {
        this.paymentType = paymentType;
    }

    public String getPaymentMode() {
        return paymentMode;
    }

    public void setPaymentMode(final String paymentMode) {
        this.paymentMode = paymentMode;
    }

    public Long getPaymentCustomerId() {
        return paymentCustomerId;
    }

    public void setPaymentCustomerId(final Long paymentCustomerId) {
        this.paymentCustomerId = paymentCustomerId;
    }

    public String getPaymentAccountName() {
        return paymentAccountName;
    }

    public void setPaymentAccountName(final String paymentAccountName) {
        this.paymentAccountName = paymentAccountName;
    }

    public String getPaymentAccountNo() {
        return paymentAccountNo;
    }

    public void setPaymentAccountNo(final String paymentAccountNo) {
        this.paymentAccountNo = paymentAccountNo;
    }

    public String getPaymentAccountBank() {
        return paymentAccountBank;
    }

    public void setPaymentAccountBank(final String paymentAccountBank) {
        this.paymentAccountBank = paymentAccountBank;
    }

    public String getPaymentBankNo() {
        return paymentBankNo;
    }

    public void setPaymentBankNo(final String paymentBankNo) {
        this.paymentBankNo = paymentBankNo;
    }

    public String getPaymentAccounts() {
        return paymentAccounts;
    }

    public void setPaymentAccounts(final String paymentAccounts) {
        this.paymentAccounts = paymentAccounts;
    }

    public String getReceiveAccountName() {
        return receiveAccountName;
    }

    public void setReceiveAccountName(final String receiveAccountName) {
        this.receiveAccountName = receiveAccountName;
    }

    public String getReceiveAccountNo() {
        return receiveAccountNo;
    }

    public void setReceiveAccountNo(final String receiveAccountNo) {
        this.receiveAccountNo = receiveAccountNo;
    }

    public String getReceiveAccountBank() {
        return receiveAccountBank;
    }

    public void setReceiveAccountBank(final String receiveAccountBank) {
        this.receiveAccountBank = receiveAccountBank;
    }

    public String getReceiveBankNo() {
        return receiveBankNo;
    }

    public void setReceiveBankNo(final String receiveBankNo) {
        this.receiveBankNo = receiveBankNo;
    }

    public String getRuleJson() {
        return ruleJson;
    }

    public void setRuleJson(final String ruleJson) {
        this.ruleJson = ruleJson;
    }

    public String getActivationFlag() {
        return activationFlag;
    }

    public void setActivationFlag(final String activationFlag) {
        this.activationFlag = activationFlag;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(final String status) {
        this.status = status;
    }

    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(final Timestamp createDate) {
        this.createDate = createDate;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(final String creator) {
        this.creator = creator;
    }

    public Long getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(final Long creatorId) {
        this.creatorId = creatorId;
    }

    public Timestamp getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(final Timestamp updateDate) {
        this.updateDate = updateDate;
    }

    public String getUpdateCreator() {
        return updateCreator;
    }

    public void setUpdateCreator(final String updateCreator) {
        this.updateCreator = updateCreator;
    }

    public Long getUpdateCreatorId() {
        return updateCreatorId;
    }

    public void setUpdateCreatorId(final Long updateCreatorId) {
        this.updateCreatorId = updateCreatorId;
    }

    public String getCustomerIdentification() {
        return this.customerIdentification;
    }

    public void setCustomerIdentification(final String anCustomerIdentification) {
        this.customerIdentification = anCustomerIdentification;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", contractId=").append(contractId);
        sb.append(", loanDataId=").append(loanDataId);
        sb.append(", detailsId=").append(detailsId);
        sb.append(", amount=").append(amount);
        sb.append(", paymentDate=").append(paymentDate);
        sb.append(", paymentType=").append(paymentType);
        sb.append(", paymentMode=").append(paymentMode);
        sb.append(", paymentCustomerId=").append(paymentCustomerId);
        sb.append(", paymentAccountName=").append(paymentAccountName);
        sb.append(", paymentAccountNo=").append(paymentAccountNo);
        sb.append(", paymentAccountBank=").append(paymentAccountBank);
        sb.append(", paymentBankNo=").append(paymentBankNo);
        sb.append(", paymentAccounts=").append(paymentAccounts);
        sb.append(", receiveAccountName=").append(receiveAccountName);
        sb.append(", receiveAccountNo=").append(receiveAccountNo);
        sb.append(", receiveAccountBank=").append(receiveAccountBank);
        sb.append(", receiveBankNo=").append(receiveBankNo);
        sb.append(", ruleJson=").append(ruleJson);
        sb.append(", activationFlag=").append(activationFlag);
        sb.append(", status=").append(status);
        sb.append(", createDate=").append(createDate);
        sb.append(", creator=").append(creator);
        sb.append(", creatorId=").append(creatorId);
        sb.append(", updateDate=").append(updateDate);
        sb.append(", updateCreator=").append(updateCreator);
        sb.append(", updateCreatorId=").append(updateCreatorId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(final Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        final PaymentPlan other = (PaymentPlan) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getContractId() == null ? other.getContractId() == null
                        : this.getContractId().equals(other.getContractId()))
                && (this.getLoanDataId() == null ? other.getLoanDataId() == null
                        : this.getLoanDataId().equals(other.getLoanDataId()))
                && (this.getDetailsId() == null ? other.getDetailsId() == null
                        : this.getDetailsId().equals(other.getDetailsId()))
                && (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount()))
                && (this.getPaymentDate() == null ? other.getPaymentDate() == null
                        : this.getPaymentDate().equals(other.getPaymentDate()))
                && (this.getPaymentType() == null ? other.getPaymentType() == null
                        : this.getPaymentType().equals(other.getPaymentType()))
                && (this.getPaymentMode() == null ? other.getPaymentMode() == null
                        : this.getPaymentMode().equals(other.getPaymentMode()))
                && (this.getPaymentCustomerId() == null ? other.getPaymentCustomerId() == null
                        : this.getPaymentCustomerId().equals(other.getPaymentCustomerId()))
                && (this.getPaymentAccountName() == null ? other.getPaymentAccountName() == null
                        : this.getPaymentAccountName().equals(other.getPaymentAccountName()))
                && (this.getPaymentAccountNo() == null ? other.getPaymentAccountNo() == null
                        : this.getPaymentAccountNo().equals(other.getPaymentAccountNo()))
                && (this.getPaymentAccountBank() == null ? other.getPaymentAccountBank() == null
                        : this.getPaymentAccountBank().equals(other.getPaymentAccountBank()))
                && (this.getPaymentBankNo() == null ? other.getPaymentBankNo() == null
                        : this.getPaymentBankNo().equals(other.getPaymentBankNo()))
                && (this.getPaymentAccounts() == null ? other.getPaymentAccounts() == null
                        : this.getPaymentAccounts().equals(other.getPaymentAccounts()))
                && (this.getReceiveAccountName() == null ? other.getReceiveAccountName() == null
                        : this.getReceiveAccountName().equals(other.getReceiveAccountName()))
                && (this.getReceiveAccountNo() == null ? other.getReceiveAccountNo() == null
                        : this.getReceiveAccountNo().equals(other.getReceiveAccountNo()))
                && (this.getReceiveAccountBank() == null ? other.getReceiveAccountBank() == null
                        : this.getReceiveAccountBank().equals(other.getReceiveAccountBank()))
                && (this.getReceiveBankNo() == null ? other.getReceiveBankNo() == null
                        : this.getReceiveBankNo().equals(other.getReceiveBankNo()))
                && (this.getRuleJson() == null ? other.getRuleJson() == null
                        : this.getRuleJson().equals(other.getRuleJson()))
                && (this.getActivationFlag() == null ? other.getActivationFlag() == null
                        : this.getActivationFlag().equals(other.getActivationFlag()))
                && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
                && (this.getCreateDate() == null ? other.getCreateDate() == null
                        : this.getCreateDate().equals(other.getCreateDate()))
                && (this.getCreator() == null ? other.getCreator() == null
                        : this.getCreator().equals(other.getCreator()))
                && (this.getCreatorId() == null ? other.getCreatorId() == null
                        : this.getCreatorId().equals(other.getCreatorId()))
                && (this.getUpdateDate() == null ? other.getUpdateDate() == null
                        : this.getUpdateDate().equals(other.getUpdateDate()))
                && (this.getUpdateCreator() == null ? other.getUpdateCreator() == null
                        : this.getUpdateCreator().equals(other.getUpdateCreator()))
                && (this.getUpdateCreatorId() == null ? other.getUpdateCreatorId() == null
                        : this.getUpdateCreatorId().equals(other.getUpdateCreatorId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getContractId() == null) ? 0 : getContractId().hashCode());
        result = prime * result + ((getLoanDataId() == null) ? 0 : getLoanDataId().hashCode());
        result = prime * result + ((getDetailsId() == null) ? 0 : getDetailsId().hashCode());
        result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode());
        result = prime * result + ((getPaymentDate() == null) ? 0 : getPaymentDate().hashCode());
        result = prime * result + ((getPaymentType() == null) ? 0 : getPaymentType().hashCode());
        result = prime * result + ((getPaymentMode() == null) ? 0 : getPaymentMode().hashCode());
        result = prime * result + ((getPaymentCustomerId() == null) ? 0 : getPaymentCustomerId().hashCode());
        result = prime * result + ((getPaymentAccountName() == null) ? 0 : getPaymentAccountName().hashCode());
        result = prime * result + ((getPaymentAccountNo() == null) ? 0 : getPaymentAccountNo().hashCode());
        result = prime * result + ((getPaymentAccountBank() == null) ? 0 : getPaymentAccountBank().hashCode());
        result = prime * result + ((getPaymentBankNo() == null) ? 0 : getPaymentBankNo().hashCode());
        result = prime * result + ((getPaymentAccounts() == null) ? 0 : getPaymentAccounts().hashCode());
        result = prime * result + ((getReceiveAccountName() == null) ? 0 : getReceiveAccountName().hashCode());
        result = prime * result + ((getReceiveAccountNo() == null) ? 0 : getReceiveAccountNo().hashCode());
        result = prime * result + ((getReceiveAccountBank() == null) ? 0 : getReceiveAccountBank().hashCode());
        result = prime * result + ((getReceiveBankNo() == null) ? 0 : getReceiveBankNo().hashCode());
        result = prime * result + ((getRuleJson() == null) ? 0 : getRuleJson().hashCode());
        result = prime * result + ((getActivationFlag() == null) ? 0 : getActivationFlag().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode());
        result = prime * result + ((getCreator() == null) ? 0 : getCreator().hashCode());
        result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode());
        result = prime * result + ((getUpdateDate() == null) ? 0 : getUpdateDate().hashCode());
        result = prime * result + ((getUpdateCreator() == null) ? 0 : getUpdateCreator().hashCode());
        result = prime * result + ((getUpdateCreatorId() == null) ? 0 : getUpdateCreatorId().hashCode());
        return result;
    }
}